package com.itheima.mall.commons;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class PageResult<T> implements Serializable {
    private long pageNum;
    private long pageSize;
    private long total;
    private long totalPage;

    private List<T> list;
    public PageResult() {
    }
    public PageResult(IPage<T> page) {
        this.pageNum = page.getSize();
        this.total = page.getTotal();
        this.totalPage = page.getPages();
        this.pageSize = page.getSize();
        this.list=page.getRecords();
    }
}
